package com.allwees.bs.core.model.wf.entity;

import com.allwees.bs.core.modelbase.entity.BaseEntity;
import com.allwees.core.wf.Action;
import com.allwees.core.wf.FsmState;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.MappedSuperclass;

/**
 * 工作流Log实体基类
 *
 * @param <S>
 * @param <A>
 * @author yangylsky
 * @since 2019-12-10
 */
@Data
@ToString
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@MappedSuperclass
public abstract class WorkflowLogEntity<S extends FsmState<S, A>, A extends Action> extends BaseEntity {
    @Column(insertable = false, updatable = false, length = 48)
    private String workflowUuid;

    /**
     * 操作员uuid
     */
    @Column(length = 48)
    private String operatorUuid;

    @Column(length = 4096)
    private String remark;

    /**
     * 本次操作
     */
    @Enumerated(EnumType.STRING)
    protected A action;

    /**
     * 上一个状态
     */
    @Enumerated(EnumType.STRING)
    protected S backState;

    /**
     * 当前状态
     */
    @Enumerated(EnumType.STRING)
    protected S state;
}
